require 'documenttransferserver'

class FakeDB
  def initialize
  end

  def create
  end

  def join(host)
  end

  def stop
  end

  def get_local(key, node_id)
    return nil
  end

  def put_local(document, document_id, node_id)
    return true
  end

  def update_local(document, document_id, node_id)
    return true
  end

  def remove_local(key, node_id)
    return true
  end

  def get_all_files_local(node_id)
    return nil
  end

  def replace_all_files_local(node_id, zip_file_buff)
    return true
  end

  def receive_replicated_db(node_id, zip)
    return true
  end

  def get(key)
    return nil
  end

  def put(document, key)
    return true
  end

  def update(document, key)
    return true
  end

  def remove(key)
    return true
  end

  def print_nodes
  end

  def conn_closed(conn)
  end
end

db = FakeDB.new

server = DocumentTransferServer.new(db)

server.listen

puts 'Pressione x para sair.'

while true
  if gets == "x\n"
    server.stop_server
    break
  end
  puts '--------------------------------------------------------'
  puts ""
  puts 'Pressione x para sair.'
end
